-
Notifications
You must be signed in to change notification settings - Fork 18
[1.20.4] Feat: Dynamic class remapping #117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements dynamic class remapping using existing dynamic reflection serialization while refactoring several file utilities and network endpoints to improve consistency and functionality.
- Removed deprecated contracts and unused file utility functions from various extensions.
- Integrated asynchronous mapping downloads with dynamic remapping support and updated endpoint documentation.
- Updated file path handling in modules to use a new relativeMCPath extension and improved download handling in the HTTP client.
Reviewed Changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| common/src/main/kotlin/com/lambda/util/extension/Other.kt | Removed experimental contracts imports. |
| common/src/main/kotlin/com/lambda/util/FolderRegister.kt | Removed deprecated file utility functions and added a relativeMCPath extension. |
| common/src/main/kotlin/com/lambda/util/FileUtils.kt | Introduced streamlined file download and utility functions. |
| common/src/main/kotlin/com/lambda/util/DynamicReflectionSerializer.kt | Added dynamic remapping support using asynchronously downloaded mappings and a configurable remap flag. |
| common/src/main/kotlin/com/lambda/util/DynamicException.kt | Implemented DynamicException to remap stack traces based on deobfuscated names. |
| common/src/main/kotlin/com/lambda/network/api/v1/endpoints/*.kt | Updated endpoint documentation to clarify return types. |
| common/src/main/kotlin/com/lambda/network/LambdaHttp.kt | Enhanced download functions with response status checks before writing content. |
| common/src/main/kotlin/com/lambda/module/modules/* | Adjusted file path references from relativePath to relativeMCPath for improved file handling. |
| common/src/main/java/com/lambda/mixin/CrashReportMixin.java | Added mixin modifications to adjust crash reporting and inject dynamic exception handling. |
Files not reviewed (1)
- common/src/main/resources/lambda.mixins.common.json: Language not supported
| private val mappings = runBlocking { | ||
| "${Network.mappings}/${Network.gameVersion}" | ||
| .downloadIfNotPresent(cache.resolveFile(Network.gameVersion)) | ||
| .map { file -> | ||
| file.readLines() | ||
| .map { it.split(' ') } | ||
| .associate { it[0].split('$').last() to it[1] } | ||
| } | ||
| .getOrElse { | ||
| LOG.error("Unable to download deobfuscated qualifiers", it) | ||
| emptyMap() | ||
| } |
Copilot
AI
Apr 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using runBlocking in the object initializer for mapping downloads can lead to performance issues during startup. Consider lazy initialization or an asynchronous approach to avoid blocking the main thread.
| private val mappings = runBlocking { | |
| "${Network.mappings}/${Network.gameVersion}" | |
| .downloadIfNotPresent(cache.resolveFile(Network.gameVersion)) | |
| .map { file -> | |
| file.readLines() | |
| .map { it.split(' ') } | |
| .associate { it[0].split('$').last() to it[1] } | |
| } | |
| .getOrElse { | |
| LOG.error("Unable to download deobfuscated qualifiers", it) | |
| emptyMap() | |
| } | |
| private val mappings by lazy { | |
| runCatching { | |
| "${Network.mappings}/${Network.gameVersion}" | |
| .downloadIfNotPresent(cache.resolveFile(Network.gameVersion)) | |
| .map { file -> | |
| file.readLines() | |
| .map { it.split(' ') } | |
| .associate { it[0].split('$').last() to it[1] } | |
| } | |
| .getOrElse { | |
| LOG.error("Unable to download deobfuscated qualifiers", it) | |
| emptyMap() | |
| } | |
| }.getOrElse { | |
| LOG.error("Error initializing mappings", it) | |
| emptyMap() | |
| } |
This pull requests implements a brand new dynamic class remapping that uses the existing dynamic reflection serializer
It allows reflection of obfuscated minecraft members for the packet logger module
Mappings are downloaded from our cloudflare bucket at
mappings.lambda-client.organd are stored loosely in the cache folderBefore:
After:
This pull request also revamps the file utilities with a more streamlined and functional approach
Examples: